home *** CD-ROM | disk | FTP | other *** search
/ Network Supervisor's Toolkit / Network Supervisor's Toolkit.iso / tools / nwtp06 / acct.pas next >
Pascal/Delphi Source File  |  1996-07-10  |  1KB  |  64 lines

  1. Program ACCT;
  2.  
  3. { Example for the NwAcct unit / NWTP 0.6, (c) 1995, R. Spronk }
  4. { Displays all login/logout account notes in the HET$ACCT.DAT file. }
  5.  
  6. uses nwMisc,nwAcct;
  7.  
  8. LABEL q;
  9.  
  10. {$I-}
  11. Var f:File of byte;
  12.  
  13.     b,b2 :Byte;
  14.     t,w  :word;
  15.     s    :string;
  16.     nTime:TnovTime;
  17.  
  18.     buf      :Array[1..4096] of byte;
  19.     NoteAKA  :TNoteRecord   ABSOLUTE buf;
  20.     ChargeAKA:TChargeRecord ABSOLUTE buf;
  21.  
  22. Begin
  23. FileMode:=0; {open file read-only }
  24. assign(f,'F:\system\net$acct.dat');
  25. reset(f);
  26. IF Ioresult<>0
  27.  then begin
  28.       writeln('Accounting file couldn''t be found..');
  29.       halt(1);
  30.       end;
  31.  
  32. REPEAT
  33.  read(f,b); {length of record}
  34.  read(f,b2);
  35.  If IOresult<>0 then goto q;
  36.  buf[1]:=b2;
  37.  buf[2]:=b;
  38.  for t:=1 to NoteAKA.Length
  39.   do begin
  40.      read(f,buf[t+2]);
  41.      if IOresult>0 then goto q;
  42.      end;
  43.  IF (NoteAKA.RecType=RT_ACCOUNT_NOTE) and (swap(NoteAKA.CommentType) IN [3,4])
  44.   then with NoteAKA
  45.         do begin
  46.            If swap(CommentType)=3
  47.             then write('Logon  of ')
  48.             else write('Logoff of ');
  49.            write(HexStr(Lswap(ClientObjId),8));
  50.            write(' from address ',HexDumpStr(Comment.Net,8),':',
  51.                                   HexDumpStr(Comment.Node,12));
  52.            Move(TimeStamp,ntime.year,6);
  53.            ntime.dayOfWeek:=0;
  54.            NovTime2String(ntime,s);delete(s,1,4);
  55.            write(' at: ',s);
  56.  
  57.            writeln;
  58.            end;
  59. UNTIL eof(f);
  60.  
  61. q: ;
  62. close(f);
  63. end.
  64.